import Layout from '@/layout/index';
import userStore from '@/store/modules/user';
var routes = function () {
    const module = 'lucy-rbac';
    if (userStore().modules.includes(module) && userStore().isAdmin) {
        return [
            {
                path: '/system',
                component: Layout,
                name: 'System',
                meta: {
                    title: '系统管理',
                    icon: 'system',
                    noCache: true
                },
                children: [
                    {
                        path: 'user',
                        component: () => import('@/module/system/pages/user/index.vue'),
                        name: 'User',
                        meta: { title: '用户管理', icon: 'user', noCache: true }
                    },
                    {
                        path: 'dept',
                        component: () => import('@/module/system/pages/dept/index.vue'),
                        name: 'Dept',
                        meta: { title: '部门管理', icon: 'tree', noCache: true }
                    },
                    {
                        path: 'role',
                        component: () => import('@/module/system/pages/role/index.vue'),
                        name: 'Role',
                        meta: { title: '角色管理', icon: 'peoples', noCache: true }
                    },
                    {
                        path: 'post',
                        component: () => import('@/module/system/pages/post/index.vue'),
                        name: 'Post',
                        meta: { title: '岗位管理', icon: 'post', noCache: true }
                    },
                    {
                        path: 'res',
                        component: () => import('@/module/system/pages/res/index.vue'),
                        name: 'Res',
                        meta: { title: '资源管理', icon: 'dict', noCache: true }
                    },
                    {
                        hidden: true,
                        path: 'config',
                        component: () => import('@/module/system/pages/config/index.vue'),
                        name: 'Config',
                        meta: { title: '配置参数', icon: 'system' }
                    }
                ]
            },
            {
                path: '/system/user-grant',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':userId(\\d+)',
                        component: () => import('@/module/system/pages/user/grant.vue'),
                        name: 'GrantUserRole',
                        meta: { title: '分配角色', noCache: true, activeMenu: '/system/user' }
                    }
                ]
            },
            {
                path: '/system/role-grant',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':roleId(\\d+)',
                        component: () => import('@/module/system/pages/role/grant.vue'),
                        name: 'GrantRoleUser',
                        meta: { title: '授权用户', noCache: true, activeMenu: '/system/role' }
                    }
                ]
            },
            {
                path: '/user',
                component: Layout,
                hidden: true,
                redirect: 'noredirect',
                children: [
                    {
                        path: 'profile',
                        component: () => import('@/module/system/pages/profile/index.vue'),
                        name: 'Profile',
                        meta: { title: '个人中心', icon: 'user' }
                    }
                ]
            }
        ]
    } else if (userStore().modules.includes(module) && !userStore().isAdmin) {
        return [
            {
                path: '/user',
                component: Layout,
                hidden: true,
                redirect: 'noredirect',
                children: [
                    {
                        path: 'profile',
                        component: () => import('@/module/system/pages/profile/index.vue'),
                        name: 'Profile',
                        meta: { title: '个人中心', icon: 'user' }
                    }
                ]
            }
        ];
    } else {
        return [];
    }


}
export default routes